//
//  CCfindHeadDetailCell.m
//  CwinCar
//
//  Created by dlios on 15/10/16.
//  Copyright © 2015年 dlios. All rights reserved.
//

#import "CCfindHeadDetailCell.h"
#import "BaseHeader.h"
@implementation CCfindHeadDetailCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}


- (void)createView
{
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 * suitableScreen_Width, 10 * suitableScreen_Width, mainScreen_Width - 20 * suitableScreen_Width, 25 * suitableScreen_Width)];
    self.nameLabel.textColor = [UIColor blackColor];
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    self.nameLabel.font = [UIFont systemFontOfSize:17.];
    [self.contentView addSubview:self.nameLabel];
    
    self.descriptionLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 * suitableScreen_Width, 70 * suitableScreen_Width, 300 * suitableScreen_Width, 25 * suitableScreen_Width)];
    self.descriptionLabel.textColor = [UIColor blackColor];
    self.descriptionLabel.textAlignment = NSTextAlignmentLeft;
    self.descriptionLabel.font = [UIFont systemFontOfSize:16.];
    self.descriptionLabel.numberOfLines = 0;
    [self.contentView addSubview:self.descriptionLabel];
    
    self.minPriceLabel = [[UILabel alloc]initWithFrame:CGRectMake(190 * suitableScreen_Width, 40 * suitableScreen_Width, 185 * suitableScreen_Width, 25 * suitableScreen_Width)];
    self.minPriceLabel.textAlignment = NSTextAlignmentLeft;
    self.minPriceLabel.textColor = [UIColor grayColor];
    self.minPriceLabel.numberOfLines = 0;
    self.minPriceLabel.font = [UIFont systemFontOfSize:14.];
    [self.contentView addSubview:self.minPriceLabel];
    
    self.priceLabel  = [[UILabel alloc]initWithFrame:CGRectMake(10 * suitableScreen_Width, 40 * suitableScreen_Width, 250 * suitableScreen_Width, 25 * suitableScreen_Width)];
    self.priceLabel.textColor = [UIColor grayColor];
    self.priceLabel.textAlignment = NSTextAlignmentLeft;
    self.priceLabel.font = [UIFont systemFontOfSize:12.5];
    [self.contentView addSubview:self.priceLabel];
    
       
}

- (void)getInfo:(CCFindHeadDetailModel * )model
{
    
    [self.nameLabel setText:model.titleName];
    [self.descriptionLabel setText:model.descriptione];
    [self.priceLabel setText:[NSString stringWithFormat:@"指导价 : %@",model.price]];
    [self.minPriceLabel setText:[NSString stringWithFormat:@"全国最低价 : %@",model.minprice]];
    
    NSInteger length = model.minprice.length;
    NSMutableAttributedString *mutableString = [[NSMutableAttributedString alloc]initWithString:self.minPriceLabel.text];
    [mutableString addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(7, length+1)];
    [mutableString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17.] range:NSMakeRange(7, length+1)];
    self.minPriceLabel.attributedText = mutableString;
    
}


@end
